function a = of6c_p2(x)
data_struct = load('data6c.mat');
prices = double(data_struct.prices);
uniqSeg = double(data_struct.uniqSeg);
uniqSeg_size = size(uniqSeg);
nNewSegments = uniqSeg_size(1);
upMat = data_struct.upMat;
[y1,y2,~]=ind2sub(size(upMat),find(upMat));

a = -sum(x(1:nNewSegments).*x(end).*(prices(y2)-prices(y1)),'all');
end